﻿@section scripts
{
    <link href="~/Content/sweet-alert.css" rel="stylesheet" />
    <script src="~/Scripts/jquery.signalR-2.1.2.min.js"></script>
    <script src="~/Scripts/sweet-alert.js"></script>
    <script type="text/javascript">

        $(function () {
            console.log('page loaded.');

            var con = $.hubConnection();
            var hub = con.createHubProxy('messageService');

            hub.on('onSend', function (msg) {
                console.log('message = ', msg);

                swal({
                    title: "消息更新",
                    text: msg,
                    timer: 2000
                });
            });

            con.start(function () {
                console.log('connection started');
            });
        });

    </script>
}
